package com.org.api.admin.controller;

import com.org.api.admin.entity.vo.TestVo;
import com.org.platform.model.ResultModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.data.mongodb.core.query.Criteria;
//import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description
 * @auther dh
 * @date 2022/3/11 14:54
 */
@Slf4j
@RestController
@RequestMapping(value = "/api/admin/test/mongo")
public class MongoController {

	/*@Autowired
	private MongoTemplate mongoTemplate;

	@RequestMapping(value = {"/indexQuery"}, method = RequestMethod.GET)
	public ResultModel indexQuery() {


//		Query query = Query.query(Criteria.where("_id").in("5d1312aeb1829c279c6c256b","5d13133ab1829c29d02ce29c"));
//  根据条件删除
		Query query = Query.query(Criteria.where("pid").in(null, "12345678"));

		mongoTemplate.remove(query, TestVo.class);

//		TestVo testVo = new TestVo();
//		testVo.setPid("12345678");
//		mongoTemplate.save(testVo);
		query = new Query();
		query.limit(100);
		List<TestVo> list = mongoTemplate.find(query, TestVo.class);
		return ResultModel.newSuccess(list);
	}*/


}

